#pragma once

#define WHITE_MAN 1
#define WHITE_KING 2
#define BLACK_MAN 3
#define BLACK_KING 4


namespace CXEngineWrapper
{
	using namespace Platform;

	// figure type enum
	public enum class eFigureType { WhiteMan, BlackMan, WhiteKing, BlackKing, Nothing };

	// coordinate class for passing checkers board
	public ref class Coordinate sealed
	{
		int _row;
		int _col;
		eFigureType _figureType;
	public:
		property int Row
		{
			int get() { return _row; }
			void set(int value) { _row = value; }
		}

		property int Col
		{
			int get() { return _col; }
			void set(int value) { _col = value; }
		}

		property eFigureType FigureType
		{
			eFigureType get() { return _figureType; }
			void set(eFigureType value) { _figureType = value; }
		}

		Coordinate(int row, int col)
		{
			_row = row;
			_col = col;
			_figureType = eFigureType::Nothing;
		}

		Coordinate(int row, int col, eFigureType figType)
		{
			Row = row;
			Col = col;
			FigureType = figType;
		}

	};

	// output bitboard class for the resulting move
	public ref class OutputBitBoard sealed
	{
		uint64 _wm;
		uint64 _bm;
		uint64 _wk;
		uint64 _bk;
		int _iEval;
		uint8 _DTM;
		int _Depth;
		int _CalmPosDepth;
		int _NumberOfNodes;
		int _NodesPerSecond;

	public:
		property uint64 wm
		{
			uint64 get() { return _wm; }
			void set(uint64 value) { _wm = value; }
		}
		property uint64 bm
		{
			uint64 get() { return _bm; }
			void set(uint64 value) { _bm = value; }
		}
		property uint64 wk
		{
			uint64 get() { return _wk; }
			void set(uint64 value) { _wk = value; }
		}
		property uint64 bk
		{
			uint64 get() { return _bk; }
			void set(uint64 value) { _bk = value; }
		}
		property int Eval
		{
			int get() { return _iEval; }
			void set(int value) { _iEval = value; }
		}
		property uint8 DTM
		{
			uint8 get() { return _DTM; }
			void set(uint8 value) { _DTM = value; }
		}
		property int Depth
		{
			int get() { return _Depth; }
			void set(int value) { _Depth = value; }
		}
		property int CalmPosDepth
		{
			int get() { return _CalmPosDepth; }
			void set(int value) { _CalmPosDepth = value; }
		}
		property int NumberOfNodes
		{
			int get() { return _NumberOfNodes; }
			void set(int value) { _NumberOfNodes = value; }
		}
		property int NodesPerSecond
		{
			int get() { return _NodesPerSecond; }
			void set(int value) { _NodesPerSecond = value; }
		}
	};


	// converts managed checkers board to bitboard
	BitBoard MakeBitBoard(const Array<Coordinate^>^ board);
	BitBoard64 MakeBitBoard64(const Array<Coordinate^>^ board);

	// convert engine bitboard to mananged output bitboard
	OutputBitBoard^ ConvertMoveBitBoard(BitBoard bb);
	OutputBitBoard^ ConvertMoveBitBoard64(BitBoard64 bb);

	// convert output managed bitboard to engine bitboard
	BitBoard ConvertFromOutputBitBoard(OutputBitBoard^ obb);
	BitBoard64 ConvertFromOutputBitBoard64(OutputBitBoard^ obb);

}
